using System;
using System.Web;
using Source.Web.FrameWork;

namespace Source.Web
{
    public class SourceHttpModule : IHttpModule
    {
        public void Init(HttpApplication context)
        {
            context.BeginRequest += context_BeginRequest;
            context.EndRequest += context_EndRequest;
        }

        private void context_BeginRequest(object sender, EventArgs e)
        {
            Disposer.EnableDisposalOfTrackedObjects();
        }

        private void context_EndRequest(object sender, EventArgs e)
        {
            Disposer.DisposeTrackedReferences();
        }

        public void Dispose() { }
    }
}